<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
		<title>{$site_title}</title>
		<link rel="stylesheet" href="{:C('__STATIC__')}{$theme}/Static/{:C('css')}/total.css" />
	</head>
	<body>
		<div id="header">
	        <div class="header">
	            <h1 class="tit">{$site_title}</h1>
	            <!--<p class="goback">-->
	                <!--<a class="return" href="index.html">返回</a>-->
	                <!--<a class="close" href="">关闭</a>-->
	            <!--</p>-->
	        </div>
	    </div>
	    <div class="dlpp-a">
	    	<div class="dlpp-aa">
		    	<p>{$name}</p>
				<input class="brand_id" type="hidden" value="{$brand_id}">
		    	<div class="dlpp-ui">
					<foreach name="ranks" item="ranks">
		    		<li class="agent_ranks"><a>{$ranks['rank_name']}</a></li>
						<input type="hidden" value="{$ranks['rank_id']}">
					</foreach>
		    	</div>
	    	</div>
	    </div>
		<span style="display: block;width: 7.5rem;height: 0.2rem;background-color:#f7f7fa;"></span>
		<div class="banx-a" style="display: none">
			<div class="a-1" id="content"></div>
				<textarea class="remark" name="remark" placeholder="请填写您的想法..." style="display: none"></textarea>
			<div id="to_this_rank">
				    <input type="hidden" class="rank_id" value="">
					<button class="ipt-ty upgrade" type="button" style="display: none">我要成为此代理</button>
				    <button class="ipt-ty upgradedoing" type="button" style="display: none">提交申请中....</button>
					<button class="ipt-gray upgrade_ready" type="button" style="display: none" disabled>已有申请等待审核</button>
					<button class="ipt-gray upgrade_ban" type="button" style="display: none" disabled>级别不符</button>
			</div>
		</div>
		<input type="button" value="请选择要升级的代理层级" class="dlpp-xyb grey" style="background:#eee;color:#717171;margin: 32px 0 0 15px "/>
		<!--<form>-->
	    	<!--<input type="button" value="下一步" class="dlpp-xyb"/>-->
	    <!--</form>-->

	     <script type="text/javascript" src="{:C('__STATIC__')}{$theme}/Static/js/jquery-2.1.4.min.js"></script>
		<script>
			function resize() {
				var clientWidth = document.documentElement.clientWidth;
				document.documentElement.style.fontSize = 100 * (clientWidth / 750) + 'px';
			}
			resize();
			window.addEventListener('resize', resize);

			$(function () {
               $(".agent_ranks").click(function(){
                   $(this).addClass("opus");
                   $(this).siblings().removeClass("opus");
                   $(this).find("a").addClass("wtf");
                   $(this).siblings().find("a").removeClass("wtf");
                   $(".rank_id").val($(this).next().val());
                   $.ajax({
					   url:"{:U('Setting/rank_view')}",
					   type:'post',
					   data:{
					       brand_id:$(".brand_id").val(),
						   id:$(this).next().val()
					   },
					   success:function (msg) {
					       $(".grey").hide();
                           $(".banx-a").show();
                           $("#content").text("介绍: "+msg['welfare']);
                           if(msg['upgrade'] ==1){
                               $(".remark").hide();
                               $(".upgrade_ban").hide();
                               $(".upgrade").hide();
                               $(".upgrade_ready").show();
						   }else if(msg['upgrade'] == 2){
                               $(".remark").show();
                               $(".upgrade").show();
                               $(".upgrade_ready").hide();
                               $(".upgrade_ban").hide();
                           }else{
                               $(".remark").hide();
                               $(".upgrade").hide();
                               $(".upgrade_ready").hide();
                               $(".upgrade_ban").show();
						   }
                       }
				   })
               })
				$(".upgrade").click(function () {
				    var remark = $(".remark").val();
				    if(!remark){
				        layer.msg('请添加备注！',{icon:8,time:1000});
						return false;
					}
					$(".upgrade").hide();
					$(".upgradedoing").show();
					$.ajax({
						url:"{:U('Setting/upgrade')}",
						type:"post",
						data:{
//						    目标rank_id
						    id:$(".rank_id").val(),
							b_id:$(".brand_id").val(),
							remark:$(".remark").val(),
						},
						success:function (msg) {
						    layer.msg("提交申请成功",{icon:1,time:1000});
                            setTimeout(function(){window.location.href = "{:U('Setting/index')}";},1000);
						}
					})
                })
            })
		</script>
		<script type="text/javascript" src="__PUBLIC__/Admin/lib/layer/2.4/layer.js"></script>
	</body>
</html>
